﻿using System.Collections.Generic;
using System.Linq;
using PhysicsControlModule.Models;

namespace PhysicsControlModule.Daos
{
    public class UserDao
    {
        public static List<User> LoadStudents(int groupId)
        {
            using (CmDbEntities db = new CmDbEntities())
                return db.User.Where(m => m.GroupId == groupId).ToList();
        }

        public static User GetById(int userId)
        {
            using (CmDbEntities db = new CmDbEntities())
                return db.User.FirstOrDefault(m => m.Id == userId);
        }
    }
}